import { createRequest } from '/@/api/service';
const module = 'ib/wechat/v1/';

/**
 * @function 微信用户登陆
 * @param data
 * @param header
 * @returns {Promise}
 */
function WX_USER_LOGIN(
  data: WechatApi.WxUserLoginReq,
  header: object = {},
): Promise<WechatApi.WxUserLoginResp> {
  return createRequest(`${process.env.APP_API_URL}${module}wxUserLogin`, data, header, 'POST');
}

/**
 * @function 微信用户登陆
 * @param data
 * @param header
 * @returns {Promise}
 */
function WX_USER_BIND(
  data: WechatApi.WxUserBindReq,
  header: object = {},
): Promise<WechatApi.WxUserBindResp> {
  return createRequest(`${process.env.APP_API_URL}${module}wxUserBind`, data, header, 'POST');
}

/**
 * @function 微信用户解除绑定
 * @param data
 * @param header
 * @returns {Promise}
 */
function WX_USER_UNBIND(
  data: WechatApi.WxUserUnbindReq,
  header: object = {},
): Promise<WechatApi.WxUserUnbindResp> {
  return createRequest(`${process.env.APP_API_URL}${module}wxUserUnbind`, data, header, 'POST');
}

export { WX_USER_LOGIN, WX_USER_BIND, WX_USER_UNBIND };
